/*
 Xern Entity Relocation Network
 Copyright (C) 2010-2011 Ronie Salgado <roniesalg@gmail.com>

 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
 in the Software without restriction, including without limitation the rights
 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 copies of the Software, and to permit persons to whom the Software is
 furnished to do so, subject to the following conditions:

 The above copyright notice and this permission notice shall be included in
 all copies or substantial portions of the Software.

 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
*/

#ifndef XERN_IRENDERER_HPP
#define XERN_IRENDERER_HPP

#include "IInterface.hpp"
#include "ICamera.hpp"
#include "IGeometry.hpp"
#include "ILight.hpp"
#include "IMaterial.hpp"
#include "ISceneNode.hpp"
#include "ITexture.hpp"

namespace Xern
{
	struct RegionMesh;
	struct IProceduralPrimitive;
	struct IRenderer: IInterface
	{
		virtual void Initialize() = 0;
		virtual void Shutdown() = 0;

		virtual bool RenderFrame(float delta) = 0;

		// Scene nodes.
		virtual boost::shared_ptr<ISceneNode> CreateSceneNode() = 0;
		virtual boost::shared_ptr<ISceneNode> CreateRegionNode() = 0;
		virtual boost::shared_ptr<ISceneNode> CreateWorldNode() = 0;

		// Cameras.
		virtual boost::shared_ptr<ICamera> CreateCamera(const std::string &name) = 0;
		virtual void SetCurrentCamera(boost::shared_ptr<ICamera> camera) = 0;

		// Materials
		virtual boost::shared_ptr<IMaterial> CreateMaterial(const std::string &baseName) = 0;

		// Textures
		virtual boost::shared_ptr<ITexture> CreateTexture2D(int width, int height, ITexture::TextureFormat format, bool dynamic=false) = 0;
		virtual boost::shared_ptr<ITexture> CreateTexture2D(int width, int height, ITexture::TextureFormat format, size_t dataLen, const void *data, float gammaFactor=1.0f) = 0;

		// Geometry.
		virtual boost::shared_ptr<IGeometry> CreateGeometry(boost::shared_ptr<RegionMesh> mesh) = 0;
		virtual boost::shared_ptr<IGeometry> CreateGeometry(const std::string &meshfile, const std::string &group) = 0;
		virtual boost::shared_ptr<IGeometry> CreateGeometry(const std::string &name, const std::string &meshfile, const std::string &group) = 0;

		// Procedural geometry.
		virtual boost::shared_ptr<IGeometry> CreateTerrainPlane(float width, float height, int mapWidth, int mapHeight, Vector3 planeNormal, bool normals) = 0;
		virtual boost::shared_ptr<IProceduralPrimitive> CreatePrimitive(int primWidth, int primHeight) = 0;

		// Lights
		virtual boost::shared_ptr<ILight> CreateLight(const std::string &name) = 0;
		virtual boost::shared_ptr<ILight> CreateLight() = 0;

		// Sky.
		virtual void SetSkybox(boost::shared_ptr<IMaterial> material) = 0;
		virtual void SetSkybox(const std::string &material) = 0;
	};

}; // namespace Xern

#endif //XERN_IRENDERER_HPP
